import request from '@/utils/request'

export function getCompanyInfo(id) {
  return request({
    url: '/company/' + id,
    method: 'GET'
  })
}

export function getRoles(params) {
  return request({
    // get传参方式是通过url,查询字符串
    // url: '/sys/role?page=' + data.page + '&pagesize=' + data.pagesize,
    url: '/sys/role',
    params,
    method: 'GET'
  })
}

export function delRole(id) {
  return request({
    url: '/sys/role/' + id,
    method: 'delete'
  })
}

export function getRoleDetail(id) {
  return request({
    url: '/sys/role/' + id,
    method: 'get'
  })
}

export function updateRole(data) {
  return request({
    url: '/sys/role/' + data.id,
    data,
    method: 'put'
  })
}

// 给角色分配权限
export function assignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
